package com.njtoyo.taxi.admin.rest.controller.business.operation_rule;

import com.njtoyo.taxi.admin.rest.wrapper.business.operation_rule.call_prepay_rule.CallPrepayRuleAddUpdateWrapper;
import com.njtoyo.taxi.admin.rest.wrapper.business.operation_rule.start_price.StartPriceAddUpdateWrapper;
import com.njtoyo.taxi.admin.service.business.StartPriceService;
import com.taxi.entity.common.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/business/operation-rule/start-price-rule")
public class StartPriceController {

    @Autowired
    private StartPriceService startPriceService;

    @GetMapping("/list")
    public RestResult list(@RequestParam(value = "current", required = false, defaultValue = "1") Integer current,
                           @RequestParam(value = "size", required = false, defaultValue = "15") Integer size,
                           @RequestParam(value = "driverRegionId", required = false) String driverRegionId) {
        return startPriceService.list(current, size, driverRegionId);
    }

    @PostMapping("/add")
    public RestResult add(@RequestBody @Validated StartPriceAddUpdateWrapper wrapper) {
        return startPriceService.add(wrapper);
    }

    @GetMapping("/getInfo/{id}")
    public RestResult getInfo(@PathVariable Long id) {
        return startPriceService.getInfo(id);
    }

    @PostMapping("/update")
    public RestResult update(@RequestBody @Validated StartPriceAddUpdateWrapper wrapper) {
        return startPriceService.update(wrapper);
    }

}
